package com.example.demo.vo.webvo

import com.example.demo.dbmodels.TUser
import com.example.demo.dbmodels.TUserRoleRef
import io.swagger.annotations.ApiModelProperty
import java.time.LocalDateTime

class UserVo {

    /**
     *  用户id
     **/
    @ApiModelProperty( "用户id")
    var id: Int? = null
    /**
     *  病区号
     **/
    @ApiModelProperty( "用户id")
    var district_code: String? = null
    /**
     *  用户代码
     **/
    @ApiModelProperty( "用户id")
    var user_code: String? = null
    /**
     *  用户名称
     **/
    @ApiModelProperty( "用户id")
    var user_name: String? = null
    /**
     *  用户类型
     **/
    @ApiModelProperty( "用户id")
    var user_type: String? = null
    /**
     *  密码
     **/
    @ApiModelProperty( "用户id")
    var password: String? = null
    /**
     *  性别（0-男、1-女、2-未知）
     **/
    @ApiModelProperty( "用户id")
    var sex: Int?= null
    /**
     *  出生日期
     **/
    @ApiModelProperty( "用户id")
    var date_birth: LocalDateTime?= null
    /**
     *  籍贯
     **/
    @ApiModelProperty( "用户id")
    var birthplace: String? = null
    /**
     *  手机
     **/
    @ApiModelProperty( "用户id")
    var mobile: String? = null
    /**
     *  电话
     **/
    @ApiModelProperty( "用户id")
    var phone: String? = null
    /**
     *  email
     **/
    @ApiModelProperty( "用户id")
    var email: String? = null
    /**
     *  证件号码
     **/
    @ApiModelProperty( "用户id")
    var id_number: String? = null
    /**
     *  证件类型
     **/
    @ApiModelProperty( "用户id")
    var id_number_type: String? = null
    /**
     *  行政区代码
     **/
    @ApiModelProperty( "用户id")
    var pca_code: String? = null
    /**
     *  地址
     **/
    @ApiModelProperty( "用户id")
    var address: String? = null
    /**
     *  密码问题
     **/
    @ApiModelProperty( "用户id")
    var password_question: String? = null
    /**
     *  密码答案
     **/
    @ApiModelProperty( "用户id")
    var password_answer: String? = null
    /**
     *  最后登录时间
     **/
    @ApiModelProperty( "用户id")
    var last_login: LocalDateTime?= null
    /**
     *  注册时间
     **/
    @ApiModelProperty( "用户id")
    var reg_time: LocalDateTime?= null
    /**
     *  注销时间
     **/
    @ApiModelProperty( "用户id")
    var cance_time: LocalDateTime?= null
    /**
     *  用户状态(0-正常、1-冻结、2-销户、3--锁定、4-账号过期)
     **/
    @ApiModelProperty( "用户id")
    var user_state: Int?= null
    /**
     *  注册终端(0-Web、1-安卓、2-IOS、99-接口用)
     **/
    @ApiModelProperty( "用户id")
    var terminal: Int?= null
    /**
     *  状态1=有效，0=无效
     **/
    @ApiModelProperty( "用户id")
    var status: Int?= null
    /**
     *  备注
     **/
    @ApiModelProperty( "用户id")
    var remark: String? = null
    /**
     *  头像路径
     **/
    @ApiModelProperty( "用户id")
    var photo_url: String? = null
    /**
     *  默认主页
     **/
    @ApiModelProperty( "用户id")
    var default_page: String? = null
    /**
     *  token
     **/
    @ApiModelProperty( "用户id")
    var token: String? = null
    /**
     *  更新时间
     **/
    @ApiModelProperty( "用户id")
    var update_time: LocalDateTime?= null
    /**
     *  更新人
     **/
    @ApiModelProperty( "用户id")
    var update_by: Int?= null
    /**
     *  删除标记
     **/
    @ApiModelProperty( "用户id")
    var is_del: Boolean?= null
    /**
     *  用户和角色关系表
     * FK_user_role_ref_BackReference
     **/
//    @ApiModelProperty( "用户id")
//    var IdTUserRoleRef: TUserRoleRef? = null


//
//    var id: Int? = null
//
//    @ApiModelProperty(name = "district_code", value = "病区号")
//    var district_code: String? = null
//
//    @ApiModelProperty(name = "user_code", value = "用户代码")
//    var user_code: String? = null
//
//    @ApiModelProperty(name = "user_name", value = "用户名称")
//    var user_name: String? = null
//
//    @ApiModelProperty(name = "user_type", value = "用户类型")
//    var user_type: String? = null
//
//    @ApiModelProperty(name = "password", value = "密码")
//    var password: String? = null
//
//    @ApiModelProperty(name = "sex", value = "性别（0-男、1-女、2-未知）")
//    var sex: Int? = null
//
//    @ApiModelProperty(name = "date_birth", value = "出生日期")
//    var date_birth: LocalDateTime? = null
//
//    @ApiModelProperty(name = "birthplace", value = "籍贯")
//    var birthplace: String? = null
//
//    @ApiModelProperty(name = "mobile", value = "手机")
//    var mobile: String? = null
//
//    @ApiModelProperty(name = "phone", value = "电话")
//    var phone: String? = null
//
//    @ApiModelProperty(name = "email", value = "email")
//    var email: String? = null
//
//    @ApiModelProperty(name = "id_number", value = "证件号码")
//    var id_number: String? = null
//
//    @ApiModelProperty(name = "id_number_type", value = "证件类型")
//    var id_number_type: String? = null
//
//    @ApiModelProperty(name = "pca_code", value = "行政区代码")
//    var pca_code: String? = null
//
//    @ApiModelProperty(name = "address", value = "地址")
//    var address: String? = null
//
//    @ApiModelProperty(name = "password_question", value = "密码问题")
//    var password_question: String? = null
//
//    @ApiModelProperty(name = "password_answer", value = "密码答案")
//    var password_answer: String? = null
//
//    @ApiModelProperty(name = "last_login", value = "最后登录时间")
//    var last_login: LocalDateTime? = null
//
//    @ApiModelProperty(name = "reg_time", value = "注册时间")
//    var reg_time: LocalDateTime? = null
//
//    @ApiModelProperty(name = "user_state", value = "用户状态(0-正常、1-冻结、2-销户、3--锁定、4-账号过期)")
//    var user_state: Int? = null
//
//    @ApiModelProperty(name = "terminal", value = "注册终端(0-Web、1-安卓、2-IOS、99-接口用)")
//    var terminal: Int? = null
//
//    @ApiModelProperty(name = "terminal", value = "状态1=有效，0=无效")
//    var status: Boolean? = null
//
//    @ApiModelProperty(name = "remark", value = "备注")
//    var remark: String? = null
//
//    @ApiModelProperty(name = "photo_url", value = "头像路径")
//    var photo_url: String? = null
//
//    @ApiModelProperty(name = "default_page", value = "默认主页")
//    var default_page: String? = null
//
//    @ApiModelProperty(name = "token", value = "token")
//    var token: String? = null
//
//    @ApiModelProperty(name = "update_time", value = "更新时间")
//    var update_time: LocalDateTime? = null
//
//    @ApiModelProperty(name = "update_by", value = "更新人")
//    var update_by: Int? = null
//
//    @ApiModelProperty(name = "is_del", value = "删除标记")
//    var is_del: Boolean? = null
//
//
    fun getVo(table: TUser?): UserVo {
        table.let {
            val data = UserVo()
            data.address = it?.address
            data.birthplace = it?.birthplace
            data.date_birth = it?.date_birth
            data.default_page = it?.default_page
            data.district_code = it?.district_code
            data.email = it?.email
            data.id = it?.id
            data.id_number = it?.id_number
            data.id_number_type = it?.id_number_type
            data.is_del = it?.is_del
            data.last_login = it?.last_login
            data.mobile = it?.mobile
            data.password = it?.password
            data.password_answer = it?.password_answer
            data.password_question = it?.password_question
            data.pca_code = it?.pca_code
            data.phone = it?.phone
            data.photo_url = it?.photo_url
            data.reg_time = it?.reg_time
            data.remark = it?.remark
            data.sex = it?.sex
            data.status = it?.status
            data.terminal = it?.terminal
            data.token = it?.token
            data.update_by = it?.update_by
            data.update_time = it?.update_time
            data.user_code = it?.user_code
            data.user_name = it?.user_name
            data.user_state = it?.user_state
            data.user_type = it?.user_type
            return  data
        }
    }

    fun getListVo(table: List<TUser>?):List<UserVo>?{
        table?.let {
            val userVoList = mutableListOf<UserVo>()
            table.forEach {
                val data = UserVo()
                data.address = it?.address
                data.birthplace = it?.birthplace
                data.date_birth = it?.date_birth
                data.default_page = it?.default_page
                data.district_code = it?.district_code
                data.email = it?.email
                data.id = it?.id
                data.id_number = it?.id_number
                data.id_number_type = it?.id_number_type
                data.is_del = it?.is_del
                data.last_login = it?.last_login
                data.mobile = it?.mobile
                data.password = it?.password
                data.password_answer = it?.password_answer
                data.password_question = it?.password_question
                data.pca_code = it?.pca_code
                data.phone = it?.phone
                data.photo_url = it?.photo_url
                data.reg_time = it?.reg_time
                data.remark = it?.remark
                data.sex = it?.sex
                data.status = it?.status
                data.terminal = it?.terminal
                data.token = it?.token
                data.update_by = it?.update_by
                data.update_time = it?.update_time
                data.user_code = it?.user_code
                data.user_name = it?.user_name
                data.user_state = it?.user_state
                data.user_type = it?.user_type

                userVoList.add(data)
            }
            return  userVoList
        }
return null
    }

}